package com.doaio.serviceuser.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class HelloController {

    @Autowired
    private RestTemplate restTemplate;

    @ResponseBody
    @RequestMapping("/")
    public String hello(){
        String str = restTemplate.getForEntity("http://service-order/",String.class).getBody();
        return "hello," + str;
    }

    @ResponseBody
    @RequestMapping("/time")
    public long time(){
        return System.currentTimeMillis() / 1000;
    }
}
